﻿using System;
using System.Windows;

namespace compshop.Modules.ClientOrderEdit.Views
{
    /// <summary>
    /// Логика взаимодействия для TypeCheckNumber.xaml
    /// </summary>
    public partial class CheckDialog : Window
    {
        public CheckDialog()
        {
            InitializeComponent();
        }
        public string Check { set; get; }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (tbCheckNumber.Text != String.Empty)
            {
                Check = tbCheckNumber.Text;
                DialogResult = true;
                Close();
            }
            else MessageBox.Show(Resource.msgCheckCannotBeEmty);
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
            Close();
        }

        private void tbCheckNumber_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
        {
            int result;
            if (!int.TryParse(e.Text, out result))
            {
                e.Handled = true;
            } 
        }
    }
}
